package qq2564874169.tuaotuao.fx.orm.mybatis;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.cursor.Cursor;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface SqlProvider {
    @UpdateProvider(type = DefaultSqlProvider.class, method = "getSql")
    int execute(Map<String, ?> param);

    @SelectProvider(type = DefaultSqlProvider.class, method = "getSql")
    @ResultType(HashMap.class)
    @Options(flushCache = Options.FlushCachePolicy.TRUE)
    List<Map<String, Object>> query(Map<String, ?> param);

    @SelectProvider(type = DefaultSqlProvider.class, method = "getSql")
    @ResultType(HashMap.class)
    @Options(flushCache = Options.FlushCachePolicy.TRUE)
    List<List<Map<String, Object>>> multiple(Map<String, ?> param);

    @SelectProvider(type = DefaultSqlProvider.class, method = "getSql")
    @ResultType(HashMap.class)
    @Options(fetchSize = Integer.MIN_VALUE, flushCache = Options.FlushCachePolicy.TRUE)
    Cursor<Map<String, Object>> cursor(Map<String, ?> param);
}
